home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4177 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: news.pge.com!usenet
  2. From: psk3@pge.com (Phillip Knight)
  3. Newsgroups: comp.lang.c++,comp.unix.programmer
  4. Subject: Re: c++ static objects and fork
  5. Date: 28 Jan 1996 17:09:55 GMT
  6. Organization: Pacific Gas and Electric
  7. Message-ID: <4egal3$jmg@news02.comp.pge.com>
  8. References: <4e8qu5$cmb@news02.comp.pge.com> <4eaqok$7pr@GIMLI.genias.de>
  9. NNTP-Posting-Host: psk3ws04.comp.pge.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.6
  13.  
  14. In article <4eaqok$7pr@GIMLI.genias.de>, andreas says...
  15. >
  16. >Hi Phil,
  17. >
  18. >I didn't test your question with an example. But I would 
  19. >say that nothing happens to these static objects. 
  20. >What should happen? 
  21. >
  22. >fork() makes a copy of the whole writable memory of the 
  23. >forked process (some special operations are done with 
  24. >open file descriptors) and starts a new process (one 
  25. >could say fork() is a kind of copy constructor for 
  26. >processes). 
  27. >
  28. >Did you expect that fork() would call a copy 
  29. >constructor for static objects?
  30.  
  31. Andreas,  I am not to concerned about the data (fork does make
  32. a complete copy), but what about all those vtable pointers, etc?
  33. Are these going to be valid (I know they are data in by themselves,
  34. but they are now in a new process, and as such, does fork guarentee
  35. their validity?).
  36.  
  37. An simple example of my concern is what happens to cin/cout/cerr/clog
  38. after a fork?  they seem to operate ok in tests, but i want to be positive
  39. (my app derives off of ostream, and after forking seem to behave somewhat
  40. strangely, although it hasnt been fully debugged yet.)
  41.  
  42. as always, thanks in advance,
  43. phil knight
  44. psk3@pge.com
  45.  
  46.